package com.ruoyi.project.module.cloudCpe.service;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.project.module.cloudCpe.mapper.CloudCpeMapper;
import com.ruoyi.project.module.cloudCpe.domain.CloudCpe;
import com.ruoyi.project.module.cloudCpe.service.ICloudCpeService;
import com.ruoyi.common.support.Convert;

/**
 * CPE管理 服务层实现
 * 
 * @author ruoyi
 * @date 2018-07-24
 */
@Service
public class CloudCpeServiceImpl implements ICloudCpeService 
{
	@Autowired
	private CloudCpeMapper cloudCpeMapper;

	/**
     * 查询CPE管理信息
     * 
     * @param cpeId CPE管理ID
     * @return CPE管理信息
     */
    @Override
	public CloudCpe selectCloudCpeById(Integer cpeId)
	{
	    return cloudCpeMapper.selectCloudCpeById(cpeId);
	}
	
	/**
     * 查询CPE管理列表
     * 
     * @param cloudCpe CPE管理信息
     * @return CPE管理集合
     */
	@Override
	public List<CloudCpe> selectCloudCpeList(CloudCpe cloudCpe)
	{
	    return cloudCpeMapper.selectCloudCpeList(cloudCpe);
	}
	
    /**
     * 新增CPE管理
     * 
     * @param cloudCpe CPE管理信息
     * @return 结果
     */
	@Override
	public int insertCloudCpe(CloudCpe cloudCpe)
	{
	    return cloudCpeMapper.insertCloudCpe(cloudCpe);
	}
	
	/**
     * 修改CPE管理
     * 
     * @param cloudCpe CPE管理信息
     * @return 结果
     */
	@Override
	public int updateCloudCpe(CloudCpe cloudCpe)
	{
	    return cloudCpeMapper.updateCloudCpe(cloudCpe);
	}
	
	/**
     * 保存CPE管理
     * 
     * @param cloudCpe CPE管理信息
     * @return 结果
     */
	@Override
	public int saveCloudCpe(CloudCpe cloudCpe)
	{
	    Integer cpeId = cloudCpe.getCpeId();
		int rows = 0;
		if (StringUtils.isNotNull(cpeId))
        {
		    rows = cloudCpeMapper.updateCloudCpe(cloudCpe);
		}
		else
        {
		    rows = cloudCpeMapper.insertCloudCpe(cloudCpe);
		}
		return rows;
	}
	
	/**
     * 删除CPE管理对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
	@Override
	public int deleteCloudCpeByIds(String ids)
	{
		return cloudCpeMapper.deleteCloudCpeByIds(Convert.toStrArray(ids));
	}
	
}
